package com.ecoolex.discount.sales.enums;

import com.ecoolex.discount.sales.entity.DiscountProductInventory;
import com.ecoolex.framework.common.EnumInterface;
import com.ecoolex.framework.common.util.Check;

public enum DiscountProductInventoryStatus implements EnumInterface<DiscountProductInventoryStatus, Integer> {
	UNUSED(1, "未使用"),
	INVALID(2, "作废"),
	FREEZE(10, "冻结"),
	USED(11, "已使用"),
	;

	private int real;

	private String describe;

	private DiscountProductInventoryStatus(int real, String describe) {
		this.real = real;
		this.describe = describe;
	}

	@Override
	public Integer real() {
		return real;
	}

	@Override
	public String describe() {
		return describe;
	}

	public static DiscountProductInventoryStatus realValueOf(Integer real) {
		if (Check.notNull(real)) {
			for (DiscountProductInventoryStatus v : values()) {
				if (v.real().equals(real)) {
					return v;
				}
			}
		}
		return null;
	}

	public static boolean canInvalid(DiscountProductInventory record) {
		return UNUSED.equal(record.getStatus());
	}

	public static boolean canEdit(DiscountProductInventory record) {
		return UNUSED.equal(record.getStatus());
	}

	public static boolean canDel(DiscountProductInventory record) {
		return UNUSED.equal(record.getStatus());
	}

}
